package com.yhao.stock.mapper;

import com.yhao.stock.entity.StockInfo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 股票信息表 Mapper 接口
 * </p>
 *
 * @author yhao
 * @since 2023-11-09
 */
@Repository
public interface StockInfoMapper extends BaseMapper<StockInfo> {

    @Select("select * from stock_info where id >= #{startId} and id <= #{endId}")
    List<StockInfo> listByRange(int startId, int endId);

    @Select("select d_name from stock_info where d_code = #{dCode}")
    String getNameByCode(String dCode);

    @Select("SELECT d_code from stock_info where d_code not like '8*' and d_code not like '68*'")
    List<String> getCommonCode();

    @Select("select * from stock_info where d_code not like '8%' and d_code not like '68%' and d_name not like 'ST%'")
    List<StockInfo> getAHInfos();

    @Select("select * from stock_info where d_code not like '8%' and d_code not like '68%' and d_name not like 'ST%' limit 20")
    List<StockInfo> getAHInfosLimit20();
}
